package demo.hms.util;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

// 拦截器
@Configuration
public class MvcItor implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //拦截
        registry.addInterceptor(new TokenInterceptor())
                // 配置拦截请求，拦截所有请求
                .addPathPatterns("/**")
                // 配置放行请求，放行login请求
                .excludePathPatterns("/user/login")
                .excludePathPatterns("/user/login2")
                .excludePathPatterns("/user/logout")
                .excludePathPatterns("/hello");
    }

}
